//
//  YSGSearchTitleView.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/4/14.
//  Copyright © 2020 QDSG. All rights reserved.
//

import UIKit

class YSGSearchTitleView: UIView {
    
    var handlerClosure: ((Bool) -> Void)?
    
    override var intrinsicContentSize: CGSize {
        return UIView.layoutFittingExpandedSize
    }
    
    @IBOutlet weak var searchView: UIView! {
        didSet {
            searchView.backgroundColor = .background
            searchView.layer.cornerRadius = searchView.height / 2
            searchView.layer.masksToBounds = true
            
            let tap = UITapGestureRecognizer(target: self, action: #selector(searchAction))
            searchView.addGestureRecognizer(tap)
        }
    }
    
    @objc private func searchAction() {
        handlerClosure?(true)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        
        setupUI()
    }
    
    private func setupUI() {
        backgroundColor = .clear
    }
}
